/**
 * Created By zhangQ 2018/2/15
 */
import axiosUtils from '@api/env/axiosEnv'

let customAxios = axiosUtils._initAxios()

/**
 * 网站建议
 * @param param
 * @returns {*}
 */
export function sendSuggestion (param) {
  return customAxios({
    url: '/sendSuggestion',
    method: 'post',
    data: {
      type: param.type,
      content: param.content,
      contactWay: param.contactWay
    }
  })
}

/**
 * 查询所有货源
 * @param param
 * @returns {*}
 */
export function getProductDemandByPage (param) {
  return customAxios({
    url: '/productDemand/getProductDemandListByPage',
    method: 'post',
    data: param
  })
}

export function getProductDemand (param) {
  return customAxios({
    url: '/productDemand/getProductDemandList',
    method: 'post',
    data: {
      product_type: param.product_type,
      msg_type: param.msg_type,
      local_city_id: param.local_city_id,
      need_city_id: param.need_city_id,
      page: param.page,
      pageSize: param.pageSize,
      isMine: param.isMine
    }
  })
}

// 查询所有货源
export function getAllcontent () {
  return customAxios({
    url: '/main/productDemand/getProductDemandList',
    method: 'post',
    data: {
      product_type: 2,
      pageSize: 8
    }
  })
}

// 按照供给查询货源
export function getAllgongcontent () {
  return customAxios({
    url: '/main/productDemand/getProductDemandList',
    method: 'post',
    data: {
      product_type: 2,
      msg_type: 2,
      pageSize: 8
    }
  })
}

// 按照需求查询货源
export function getAllxucontent () {
  return customAxios({
    url: '/main/productDemand/getProductDemandList',
    method: 'post',
    data: {
      product_type: 2,
      msg_type: 1,
      pageSize: 8
    }
  })
}

// 所有动力货源
export function getAlldongcontent () {
  return customAxios({
    url: '/main/productDemand/getProductDemandList',
    method: 'post',
    data: {
      product_type: 1,
      pageSize: 8
    }
  })
}

// 需求动力货源
export function getAlldongxucontent () {
  return customAxios({
    url: '/main/productDemand/getProductDemandList',
    method: 'post',
    data: {
      product_type: 1,
      msg_type: 1,
      pageSize: 8
    }
  })
}

// 供给动力货源
export function getAlldonggongcontent () {
  return customAxios({
    url: '/main/productDemand/getProductDemandList',
    method: 'post',
    data: {
      product_type: 1,
      msg_type: 2,
      pageSize: 8
    }
  })
}

// 运价查询
export function getWayPrice (param) {
  return customAxios({
    url: '/queryFreight',
    method: 'post',
    data: {
      productNameId: param.productNameId,
      startStationCode: param.startStationCode,
      endStationCode: param.endStationCode,
      isSmqh: param.isSmqh,
      isSmzc: param.isSmzc,
      isShsm: param.isShsm,
      isSmxc: param.isSmxc,
      isTlzx: param.isTlzx
    }
  })
}

export function queryFreight (param) {
  return customAxios({
    url: '/queryFreight',
    method: 'post',
    data: {
      productNameId: param.productNameId,
      startStationCode: param.startStationCode,
      endStationCode: param.endStationCode,
      isSmqh: param.isSmqh,
      isSmzc: param.isSmzc,
      isShsm: param.isShsm,
      isSmxc: param.isSmxc,
      isTlzc: param.isTlzc
    }
  })
}

export function getStationInfo () {
  return customAxios({
    url: '/getStationInfo',
    method: 'post'
  })
}

// 获取仓储筛选路局数据
export function getRailwayList () {
  return customAxios({
    url: '/getRailWayBureauInfo',
    method: 'post'
  })
}

// 睿号信息查询
export function nbSelect (param) {
  return customAxios({
    url: '/nbSelect',
    method: 'post',
    data: {
      number: param.number
    }
  })
}

// 新闻列表
export function getAllList (param) {
  return customAxios({
    url: '/content/getAllList',
    method: 'post',
    data: param
  })
}

// 新闻内容
export function getAllListInfo (id) {
  return customAxios({
    url: '/content/getInfo',
    method: 'post',
    data: {
      id: id
    }
  })
}
// 获取临时用户
export function getTempUser () {
  return customAxios({
    url: '/tempUser/getTempUser',
    method: 'post'
  })
}
// 获取客服列表
export function getCustomerServiceList () {
  return customAxios({
    url: '/getCustomerServiceList',
    method: 'post'
  })
}
